
import sublime, sublime_plugin
import os, threading

class wlgame_update_appCommand(sublime_plugin.TextCommand):

	def doUpdate(self):
		# 暂存本地修改，拉取新代码
		os.system("git stash & git pull & git stash pop & echo \"插件更新成功\" & pause")


	def run(self, edit):

		view = self.view

		root = sublime.packages_path()

		settings = sublime.load_settings("wlgame-plugin.sublime-settings")
		projectName = settings.get("project_name")
		workDir = os.path.join(root, "wlgame-plugin")
		# 切换到工作目录
		os.chdir(workDir)

		t = threading.Thread(target=self.doUpdate, args=())
		t.start()